<!-- 扣费规则 -->
<template>
	<div>
		<el-form :model="editFrom" ref="editFrom" :rules="rules" >
			<el-form-item label="保险费用设置(元)" prop="bxfy">
				<el-input v-model="editFrom.bxfy" placeholder="请输入用户名" size="large"></el-input>
			</el-form-item>
			<el-form-item label="订单费用设置(元):" prop="ddfy">
				<el-input v-model="editFrom.ddfy" placeholder="请输入手机号" size="large"></el-input>
			</el-form-item>
		</el-form>
		<div class="dialog-footer">
			<el-button @click="closedialog">取 消</el-button>
			<el-button type="primary" @click="saveEdit">确 定</el-button>
		</div>
	</div>
</template>

<script>
import { } from '@/api/index';

export default {
	name: 'editStudent',
	props: {
		Infoitem: Object
	},
	data() {
	    return {
	        show:true,
			editFrom:{},
			rules: {
				bxfy: [{ required: true, message: '请设置保险费用', trigger: 'blur' }],
				ddfy: [{ required: true, message: '请设置订单费用', trigger: 'blur' }],
			},
	    };
	},
	mounted() {
		this.getDetil()
	},
	methods:{
		getDetil(){
			var parems = {
				id:'369ba770561e4bd1a2f6fd26bae99009'
			}
			getfMoneyById(parems).then(res => {
				if (res.code == 200) {
					this.editFrom = res.data
				} 
			});
		},
		saveEdit(){
			this.$refs.editFrom.validate(valid => {
			    if (valid) {
					addCostAPI(this.editFrom).then(res => {
						if(res.code == 200){
							this.$message.success(`设置成功`);
							this.closedialog();
						}else{
							this.$message.error(res.msg);
						}
					});
			    } else {
			        console.log('error submit!!');
			        return false;
			    }
			});
		},
		closedialog() {
			this.$emit('closeDialog', false);
		}
	}
};
</script>

<style scoped>
.dialog-footer {
	width: 100%;
	text-align: right;
}
/deep/.el-col-12{
	padding: 0 15px;
}
</style>
